﻿@model ListViewModel<CommonSearchValues, IQueryable<QizSmsSession>>
@{
    ViewBag.Title = "短信随访单查询";
    DateTime TimeZero = new DateTime(2000, 1, 1);
}
@using (Ajax.BeginForm("QizSmsSessionList", new AjaxOptions { HttpMethod = "Post", LoadingElementId = "OnLoadingSpan", UpdateTargetId = "main", OnFailure = "OnSiteError" }))
{<p>
    <fieldset>
        <legend>
            <div class="catalog-title">
                短信随访单查询</div>
        </legend>
        @Html.Action("SmsSFReport")
        <div class="small-input">
            @Html.HiddenFor(m => Model.PageSize)
           <input type="hidden" name="PageIdx" id="qspidx" value="0" />
            &nbsp;&nbsp;随访单名称： @Html.TextBoxFor(m => m.SearchFrom.V4, new { ID = "CV" }) @*, new SelectList(ViewBag.Subjects, "ID", "Title", Model.SearchFrom.V1), "全部")*@
            <a title="选择常规随访。数据很多，请耐心等待..." href="#" onclick="$('#dialogbox').load('@(Url.Action("QizSmsSubjectTree"))',null,function(){showDialogEx('#dialogbox','请选择',true);});return false;">
                [选择…]</a>&nbsp; &nbsp;填报人：@Html.TextBoxFor(m => m.SearchFrom.V2) @*, new SelectList(ViewBag.Recupers, "UserID", "UserName", Model.SearchFrom.V2), "全部")*@
            &nbsp;开始时间：@Html.EditorFor(m => m.SearchFrom.V3, "DateTimeStr")
            结束时间：@Html.EditorFor(m => m.SearchTo.V3, "DateTimeStr")
            @Helpers.SubmitButton("查询", "qssubmit")
        </div>
    </fieldset>
    </p>
}
<table class="width">
    <tr>
        <th>
            随访单名称
        </th>
        <th>
            医院
        </th>
        <th>
            科室
        </th>
        <th>
            病区
        </th>
        <th>
            医生
        </th>
        <th>
            填报人
        </th>
        <th>
            检查时间
        </th>
        <th>
            填报方式
        </th>           
    </tr>
    @{int dColor = 0;}
    @foreach (var item in Model.Data)
    {
        <tr class="tr-backColor@(dColor++%2)" style="@(item.SessionAutoEvalution == "异常" ? "color:red" : "")">
            <td>
            @if (item.QizSmsSubjectMonthIdx.QizSmsSubject != null)
            {
            @Ajax.ActionLink(item.QizSmsSubjectMonthIdx.QizSmsSubject.Title, "QizSmsSessionView", new { ID = item.ID, PreviewOnly = true }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('短信随访内容');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
            }
            @*@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.Title)*@
            </td>
            <td>@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.QizSubject.Hospital.HospName)
            </td>
            <td>@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.QizSubject.Department.BingQu.Title)
            </td>
            <td>@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.QizSubject.Department.DepName)
            </td>
            <td>@*@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.QizSubjectObjForDoctors.FirstOrDefault(v=>v.DoctorID == item.QizSmsSubjectMonthIdx.QizSmsSubject.DoctorID).Doctor.UserName)*@
            @Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.aspnet_Users.UserName)
            </td>
            <td>@Html.DisplayFor(model => item.Recuper.User.UserName)
            </td>
            <td> 
            @if (item.Timemark != TimeZero)
            {
                @Helpers.DateTimeString(item.Timemark,"yyyy-MM-dd")
            }
            </td>
            <td>短信
            </td>
        </tr>
    }
</table>

@Html.Partial("Pagger", new PaggerViewModel { Act = "QizSmsSessionList", PageIdx = Model.PageIdx, PageCount = Model.PageCount, ItemCount = Model.ItemCount })

@Html.Partial("TrHilighter")